<?php
	require 'database.php';
	require 'model/reqservico.php';
	require_once 'syslogin/usuario.php';
	require_once 'syslogin/autenticador.php';
	require_once 'syslogin/sessao.php';
	
	$aut = Autenticador::instanciar();
	$usuario = null;
	if ($aut->esta_logado()) {
		$usuario = $aut->pegar_usuario();
	}
	else {
		$aut->expulsar();
	}
	
	$pdo = Database::connect();
	$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
	$sql = "SELECT * FROM reqservico WHERE status = 'pendente'";
	$q = $pdo->prepare($sql);
	$q->execute();
	$data = $q->fetchAll(PDO::FETCH_ASSOC);
	Database::disconnect();
?>
<!DOCTYPE html>
<html lang="pt-br">
	<head>
		<meta charset="utf-8"/>
		<title>SIRI - Sistema de Requerimentos</title>
		<link rel="shortcut icon" href="img/favicon.ico">
		<style type="text/css">@import url('css/bootstrap.css');</style>
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<link href="css/style.css" rel="stylesheet">
		<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
	</head>
	<body>
		<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">
						<span class="glyphicon glyphicon-user"></span> <strong>Serviços</strong>
					</h3>
				</div>
				<div class="panel-body">
			<div class="row clearfix">
				<div class="col-md-12 column">
					<div class="row clearfix">
						<div class="col-md-1 column">
						</div>
						<div class="col-md-10 column">
							<table class="table table-hover table-condensed table-bordered lista-servico" align="center">
					  …			<thead>
								<tr>
									<!--<th>ID</th>-->
									<th>Solicitante</th>
									<th>Matrícula</th>
									<th>Data</th>
									<th>Serviço</th>
									<th>Local</th>
									<th>Status</th>
									<th>PDF</th>
								</tr>
								</thead>
								<tbody>
								<?php 
									foreach($data as $dados){
										echo '<tr>';
											//echo '<td>'.$dados['idservico'].'</td>';
											echo '<td>'.$dados['solicitante'].'</td>';
											echo '<td>'.$dados['matricula'].'</td>';
											$reqservico = new reqservico();
											$data = $reqservico->dataFormatada($dados['data']);
											echo '<td>'.$data.'</td>';
											echo '<td>'.$dados['servico'].'</td>';
											echo '<td>'.$dados['local_reparo'].'</td>';
											echo '<td><a href="principal_aprova.php?id_=status_servico&id='.$dados['idservico'].'" class="laranja">'.$dados['status'].'</a></td>';
											echo '<td><a href="requerimento_pdf_admin.php?id='.$dados['idservico'].'">abrir</a></td>';
										echo '</tr>';
									}
								?>
								</tbody>
							</table>
						</div>
						<div class="col-md-1 column">
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="panel-footer">
					<small><p class="text-right text-muted">Desenvolvido pela <a href="http://www.ifsertao-pe.edu.br/dgti" target="_blank" title="Coordenação de Tecnologia da Informação">CTI</a></p></small>
	</div>
	</div>
	<script src="http://code.jquery.com/jquery-latest.min.js"></script>
	<script src="js/bootstrap.js"></script>
	</body>
</html>